package com.wrupple.muba.common.domain;

import java.io.Serializable;

import com.google.gwt.user.client.rpc.IsSerializable;

/**
 * a RawSlice is an unconfigured version of a {@link Slice} and contains all
 * data required to call the server, initialize and configure the Slice.
 * 
 * A {@link Slice}'s name can only be obtained via it's corresponding RawSlice,
 * 
 * @author japi
 * 
 */
public class RawSlice implements Serializable, IsSerializable {

	private static final long serialVersionUID = -8724068983904696008L;
	
	/**
	 * This slices default name, also the name of the module this slice belongs
	 * to (if any)
	 */
	private String defaultName;
	/**
	 * The configured instance of this Raw Slice
	 */
	private Slice slice;

	private String configurationURI;

	/**
	 * 
	 */
	public RawSlice() {
		super();
	}


	/**
	 * @return This slices default name, also the name of the module this slice
	 *         belongs to (if any)
	 */
	public String getDefaultName() {
		return defaultName;
	}


	/**
	 * @return the configutared representation of this slice
	 */
	public Slice getSlice() {
		return slice;
	}



	/**
	 * @param defaultName
	 *            This slices default name, also the name of the module this
	 *            slice belongs to (if any)
	 */
	public void setDefaultName(String defaultName) {
		this.defaultName = defaultName;
	}


	/**
	 * @param slice
	 *            configutared representation of this slice to set
	 */
	public void setSlice(Slice slice) {
		if (slice != null) {
			this.slice = slice;
			if (this.slice.getRawApp() != this) {
				this.slice.setRawApp(this);
			}
		}
	}


	public String getConfigurationURI() {
		return configurationURI;
	}


	public void setConfigurationURI(String configurationURI) {
		this.configurationURI = configurationURI;
	}

}
